package YAPserver.mods.list;

import java.util.Random;

import YAPserver.mods.ModBehaviour;
/**
 * This is the abstract class for groups of mods. All mod groups should extend this class. That way there is only one method left to implement, namely fill().
 * @author Daniel
 *
 */
abstract public class AbstractModGroup implements ModGroup {
	protected ModList m_mods = new ModList();
	//the chances for a mod to crop up
	protected static final int low = 1;
	protected static final int medium = 3;
	protected static final int high = 5;
	
	/**
	 * The sole constructor. Creates a new group of mods. (This group cannot be changed.)
	 */
	AbstractModGroup(){
		fill();
	}
	
	@Override
	public ModBehaviour randomMod() {
		Random rand = new Random();
		int size = m_mods.size();
		int i = rand.nextInt(size);
		return m_mods.get(i);
	}
	
	@Override
	public void add(ModBehaviour mod){
		m_mods.add(1, mod);
	}
	
	/**
	 * Fills the group up with modBehaviour's and their frequency.
	 */
	protected abstract void fill();
}
